home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 526-550 / disk_534 / term / source.lzh / SerialPanel.c < prev    next >
C/C++ Source or Header  |  1991-07-06  |  15KB  |  546 lines

  1. /* $Revision Header * Header built automatically - do not edit! *************
  2.  *
  3.  *    (C) Copyright 1990 by Olaf 'Olsen' Barthel & MXM
  4.  *
  5.  *    Name .....: SerialPanel.c
  6.  *    Created ..: Monday 21-Jan-91 20:12
  7.  *    Revision .: 0
  8.  *
  9.  *    Date            Author          Comment
  10.  *    =========       ========        ====================
  11.  *    21-Jan-91       Olsen           Created this file!
  12.  *
  13.  * $Revision Header ********************************************************/
  14.  
  15. #include "TermGlobal.h"
  16.  
  17. enum    {    GAD_BAUD,GAD_DATABITS,GAD_PARITY,GAD_STOPBITS,GAD_HANDSHAKING,GAD_DUPLEX,
  18.         GAD_HIGHSPEED,GAD_BREAKLENGTH,GAD_DEVICE,GAD_UNIT,GAD_USE,GAD_CANCEL };
  19.  
  20. #define WIDTH    335
  21. #define HEIGHT    159
  22.  
  23. STATIC LONG Bauds[12] =
  24. {
  25.     110,300,1200,2400,4800,9600,19200,31250,38400,57600,76800,115200
  26. };
  27.  
  28. STATIC STRPTR DataBits[3] =
  29. {
  30.     (STRPTR)"Seven",
  31.     (STRPTR)"Eight",
  32.     NULL
  33. };
  34.  
  35. STATIC STRPTR Parity[6] =
  36. {
  37.     (STRPTR)"None",
  38.     (STRPTR)"Even",
  39.     (STRPTR)"Odd",
  40.     (STRPTR)"Mark",
  41.     (STRPTR)"Space",
  42.     NULL
  43. };
  44.  
  45. STATIC STRPTR StopBits[3] =
  46. {
  47.     (STRPTR)"One",
  48.     (STRPTR)"Two",
  49.     NULL
  50. };
  51.  
  52. STATIC STRPTR Handshaking[4] =
  53. {
  54.     (STRPTR)"XON/XOFF",
  55.     (STRPTR)"RTS/CTS",
  56.     (STRPTR)"None",
  57.     NULL
  58. };
  59.  
  60. STATIC STRPTR Duplex[3] =
  61. {
  62.     (STRPTR)"Full",
  63.     (STRPTR)"Half (Local Echo)",
  64.     NULL
  65. };
  66.  
  67. enum    {    MEN_BAUD=1,MEN_DATABITS,MEN_PARITY,MEN_STOPBITS,MEN_HANDSHAKING,
  68.         MEN_DUPLEX,MEN_HIGHSPEED,MEN_USE,MEN_CANCEL,MEN_QUITPANEL };
  69.  
  70. STATIC struct NewMenu SerialMenu[] =
  71. {
  72.     { NM_TITLE, "Project",         0 , 0, 0, (APTR)0},
  73.     {  NM_ITEM, "Baud Rate",    "R", 0, 0, (APTR)MEN_BAUD},
  74.     {  NM_ITEM, "Bits/Char",    "B", 0, 0, (APTR)MEN_DATABITS},
  75.     {  NM_ITEM, "Parity",        "P", 0, 0, (APTR)MEN_PARITY},
  76.     {  NM_ITEM, "Stop Bits",    "S", 0, 0, (APTR)MEN_STOPBITS},
  77.     {  NM_ITEM, "Handshaking",    "H", 0, 0, (APTR)MEN_HANDSHAKING},
  78.     {  NM_ITEM, "Duplex",        "D", 0, 0, (APTR)MEN_DUPLEX},
  79.     {  NM_ITEM, "High Speed Mode",    "M", 0, 0, (APTR)MEN_HIGHSPEED},
  80.     {  NM_ITEM, NM_BARLABEL,     0 , 0, 0, (APTR)0},
  81.     {  NM_ITEM, "Use",        "U", 0, 0, (APTR)MEN_USE},
  82.     {  NM_ITEM, "Cancel",        "C", 0, 0, (APTR)MEN_CANCEL},
  83.     {  NM_ITEM, NM_BARLABEL,     0 , 0, 0, (APTR)0},
  84.     {  NM_ITEM, "Quit",        "Q", 0, 0, (APTR)MEN_QUITPANEL},
  85.     { NM_END, 0,             0 , 0, 0, (APTR)0}
  86. };
  87.  
  88. STATIC LONG __saveds
  89. ShowBaud(struct Gadget *SomeGadget,WORD Level)
  90. {
  91.     return(Bauds[Level]);
  92. }
  93.  
  94. STATIC struct Gadget *
  95. CreateAllGadgets(struct Configuration *Config,struct Gadget **GadgetArray,struct Gadget **GadgetList,APTR VisualInfo,UWORD TopEdge)
  96. {
  97.     struct Gadget        *Gadget;
  98.     struct NewGadget     NewGadget;
  99.     UWORD             Counter = 0;
  100.     SHORT             i,Rate;
  101.  
  102.     if(Gadget = CreateContext(GadgetList))
  103.     {
  104.         for(i = 0 ; i < 13 ; i++)
  105.         {
  106.             if(Config -> BaudRate == Bauds[i])
  107.             {
  108.                 Rate = i;
  109.                 break;
  110.             }
  111.         }
  112.  
  113.         NewGadget . ng_Width        = 164;
  114.         NewGadget . ng_Height        = 12;
  115.         NewGadget . ng_GadgetText    = "  Baud _Rate       ";
  116.         NewGadget . ng_TextAttr        = &DefaultFont;
  117.         NewGadget . ng_VisualInfo    = VisualInfo;
  118.         NewGadget . ng_GadgetID        = Counter;
  119.         NewGadget . ng_Flags        = NG_HIGHLABEL;
  120.         NewGadget . ng_LeftEdge        = (strlen(NewGadget . ng_GadgetText) + 2 - 1) * 8 + 1;
  121.         NewGadget . ng_TopEdge        = 1 + TopEdge;
  122.  
  123.         GadgetArray[Counter++] = Gadget = CreateGadget(SLIDER_KIND,Gadget,&NewGadget,
  124.             GT_Underscore,        '_',
  125.             GTSL_Min,        0,
  126.             GTSL_Max,        11,
  127.             GTSL_Level,        Rate,
  128.             GTSL_DispFunc,        ShowBaud,
  129.             GTSL_LevelFormat,    "%6ld",
  130.             GTSL_MaxLevelLen,    6,
  131.         TAG_DONE);
  132.  
  133.         NewGadget . ng_GadgetText    = "_Bits/Char";
  134.         NewGadget . ng_GadgetID        = Counter;
  135.         NewGadget . ng_TopEdge        = Gadget -> TopEdge + Gadget -> Height + 4;
  136.  
  137.         GadgetArray[Counter++] = Gadget = CreateGadget(CYCLE_KIND,Gadget,&NewGadget,
  138.             GT_Underscore,    '_',
  139.             GTCY_Labels,    DataBits,
  140.             GTCY_Active,    Config -> BitsPerChar - 7,
  141.         TAG_DONE);
  142.  
  143.         NewGadget . ng_GadgetText    = "_Parity";
  144.         NewGadget . ng_GadgetID        = Counter;
  145.         NewGadget . ng_TopEdge        = Gadget -> TopEdge + Gadget -> Height + 1;
  146.  
  147.         GadgetArray[Counter++] = Gadget = CreateGadget(CYCLE_KIND,Gadget,&NewGadget,
  148.             GT_Underscore,    '_',
  149.             GTCY_Labels,    Parity,
  150.             GTCY_Active,    Config -> Parity,
  151.         TAG_DONE);
  152.  
  153.         NewGadget . ng_GadgetText    = "_Stop Bits";
  154.         NewGadget . ng_GadgetID        = Counter;
  155.         NewGadget . ng_TopEdge        = Gadget -> TopEdge + Gadget -> Height + 1;
  156.  
  157.         GadgetArray[Counter++] = Gadget = CreateGadget(CYCLE_KIND,Gadget,&NewGadget,
  158.             GT_Underscore,    '_',
  159.             GTCY_Labels,    StopBits,
  160.             GTCY_Active,    Config -> StopBits - 1,
  161.         TAG_DONE);
  162.  
  163.         NewGadget . ng_GadgetText    = "_Handshaking";
  164.         NewGadget . ng_GadgetID        = Counter;
  165.         NewGadget . ng_TopEdge        = Gadget -> TopEdge + Gadget -> Height + 1;
  166.  
  167.         GadgetArray[Counter++] = Gadget = CreateGadget(CYCLE_KIND,Gadget,&NewGadget,
  168.             GT_Underscore,    '_',
  169.             GTCY_Labels,    Handshaking,
  170.             GTCY_Active,    Config -> Handshaking,
  171.         TAG_DONE);
  172.  
  173.         NewGadget . ng_GadgetText    = "_Duplex";
  174.         NewGadget . ng_GadgetID        = Counter;
  175.         NewGadget . ng_TopEdge        = Gadget -> TopEdge + Gadget -> Height + 1;
  176.  
  177.         GadgetArray[Counter++] = Gadget = CreateGadget(CYCLE_KIND,Gadget,&NewGadget,
  178.             GT_Underscore,    '_',
  179.             GTCY_Labels,    Duplex,
  180.             GTCY_Active,    Config -> Duplex,
  181.         TAG_DONE);
  182.  
  183.         NewGadget . ng_GadgetText    = "High-Speed _Mode";
  184.         NewGadget . ng_GadgetID        = Counter;
  185.         NewGadget . ng_TopEdge        = Gadget -> TopEdge + Gadget -> Height + 2;
  186.  
  187.         GadgetArray[Counter++] = Gadget = CreateGadget(CHECKBOX_KIND,Gadget,&NewGadget,
  188.             GT_Underscore,    '_',
  189.             GTCB_Checked,    Config -> HighSpeed,
  190.         TAG_DONE);
  191.  
  192.         NewGadget . ng_GadgetText    = "Break Length (µs)";
  193.         NewGadget . ng_GadgetID        = Counter;
  194.         NewGadget . ng_TopEdge        = Gadget -> TopEdge + Gadget -> Height + 2;
  195.  
  196.         GadgetArray[Counter++] = Gadget = CreateGadget(INTEGER_KIND,Gadget,&NewGadget,
  197.             GTIN_MaxChars,    8,
  198.             GTIN_Number,    Config -> BreakLength,
  199.         TAG_DONE);
  200.  
  201.         NewGadget . ng_GadgetText    = "Serial Device";
  202.         NewGadget . ng_GadgetID        = Counter;
  203.         NewGadget . ng_TopEdge        = Gadget -> TopEdge + Gadget -> Height + 4;
  204.  
  205.         GadgetArray[Counter++] = Gadget = CreateGadget(STRING_KIND,Gadget,&NewGadget,
  206.             GTST_MaxChars,    40,
  207.             GTST_String,    Config -> SerialDevice,
  208.         TAG_DONE);
  209.  
  210.         NewGadget . ng_GadgetText    = "Device Unit Number";
  211.         NewGadget . ng_GadgetID        = Counter;
  212.         NewGadget . ng_TopEdge        = Gadget -> TopEdge + Gadget -> Height + 2;
  213.  
  214.         GadgetArray[Counter++] = Gadget = CreateGadget(INTEGER_KIND,Gadget,&NewGadget,
  215.             GTIN_MaxChars,    2,
  216.             GTIN_Number,    Config -> UnitNumber,
  217.         TAG_DONE);
  218.  
  219.         NewGadget . ng_Width        = 52;
  220.         NewGadget . ng_Height        = 12;
  221.         NewGadget . ng_GadgetText    = "_Use";
  222.         NewGadget . ng_GadgetID        = Counter;
  223.         NewGadget . ng_Flags        = 0;
  224.         NewGadget . ng_LeftEdge        = 10;
  225.         NewGadget . ng_TopEdge        = HEIGHT - 3 - NewGadget . ng_Height;
  226.  
  227.         GadgetArray[Counter++] = Gadget = CreateGadget(BUTTON_KIND,Gadget,&NewGadget,
  228.             GT_Underscore,    '_',
  229.         TAG_DONE);
  230.  
  231.         NewGadget . ng_GadgetText    = "_Cancel";
  232.         NewGadget . ng_GadgetID        = Counter;
  233.         NewGadget . ng_LeftEdge        = WIDTH - 10 - NewGadget . ng_Width;
  234.  
  235.         GadgetArray[Counter++] = Gadget = CreateGadget(BUTTON_KIND,Gadget,&NewGadget,
  236.             GT_Underscore,    '_',
  237.         TAG_DONE);
  238.     }
  239.  
  240.     DubGadList(GadgetArray[0]);
  241.  
  242.     return(Gadget);
  243. }
  244.  
  245. BYTE
  246. SerialPanel(struct Configuration *Config)
  247. {
  248.     struct Window    *PanelWindow;
  249.     struct Menu    *PanelMenu;
  250.     struct Gadget    *GadgetList;
  251.     struct Gadget    *GadgetArray[GAD_CANCEL + 1];
  252.  
  253.     LONG         i;
  254.  
  255.     CopyMem(Config,&PrivateConfig,sizeof(struct Configuration));
  256.  
  257.     if(CreateAllGadgets(Config,&GadgetArray[0],&GadgetList,VisualInfo,Screen -> WBorTop + Screen -> Font -> ta_YSize + 1))
  258.     {
  259.         if(PanelMenu = CreateMenus(SerialMenu,
  260.             GTMN_FrontPen, 0,
  261.         TAG_DONE))
  262.         {
  263.             if(LayoutMenus(PanelMenu,VisualInfo,
  264.                 GTMN_TextAttr,&DefaultFont,
  265.             TAG_DONE))
  266.             {
  267.                 if(PanelWindow = OpenWindowTags(NULL,
  268.                     WA_Left,    (Screen -> Width - WIDTH) >> 1,
  269.                     WA_Top,        (Screen -> Height - HEIGHT) >> 1,
  270.                     WA_Width,    WIDTH,
  271.                     WA_Height,    HEIGHT,
  272.  
  273.                     WA_Activate,    TRUE,
  274.                     WA_DragBar,    TRUE,
  275.                     WA_DepthGadget,    TRUE,
  276.                     WA_RMBTrap,    TRUE,
  277.                     WA_DepthGadget,    TRUE,
  278.                     WA_CloseGadget,    TRUE,
  279.                     WA_CustomScreen,Screen,
  280.  
  281.                     WA_IDCMP,    IDCMP_GADGETDOWN | IDCMP_ACTIVEWINDOW | IDCMP_CLOSEWINDOW | SLIDERIDCMP | CHECKBOXIDCMP | LISTVIEWIDCMP | IDCMP_MENUPICK | IDCMP_RAWKEY,
  282.  
  283.                     WA_Title,    "Serial Preferences",
  284.                 TAG_DONE))
  285.                 {
  286.                     struct IntuiMessage    *Massage;
  287.                     ULONG             Class,Code,Value;
  288.                     struct Gadget        *Gadget;
  289.                     BYTE             Terminated = FALSE;
  290.  
  291.                     PushWindow(PanelWindow);
  292.  
  293.                     AddGList(PanelWindow,GadgetList,(UWORD)-1,(UWORD)-1,NULL);
  294.                     RefreshGList(GadgetList,PanelWindow,NULL,(UWORD)-1);
  295.                     GT_RefreshWindow(PanelWindow,NULL);
  296.  
  297.                     SetMenuStrip(PanelWindow,PanelMenu);
  298.  
  299.                     PanelWindow -> Flags &= ~WFLG_RMBTRAP;
  300.  
  301.                     ActivateGadget(GadgetArray[GAD_BREAKLENGTH],PanelWindow,NULL);
  302.  
  303.                     ActiveGadget = GadgetArray[GAD_BREAKLENGTH];
  304.  
  305.                     while(!Terminated)
  306.                     {
  307.                         WaitPort(PanelWindow -> UserPort);
  308.  
  309.                         while(!Terminated && (Massage = (struct IntuiMessage *)GT_GetIMsg(PanelWindow -> UserPort)))
  310.                         {
  311.                             Class    = Massage -> Class;
  312.                             Code    = Massage -> Code;
  313.                             Gadget    = (struct Gadget *)Massage -> IAddress;
  314.  
  315.                             GT_ReplyIMsg(Massage);
  316.  
  317.                             if(Class == IDCMP_GADGETDOWN)
  318.                             {
  319.                                 if((Gadget -> GadgetType & GTYP_GTYPEMASK) == STRGADGET)
  320.                                     ActiveGadget = Gadget;
  321.                             }
  322.  
  323.                             if(Class == IDCMP_ACTIVEWINDOW && ActiveGadget)
  324.                                 ActivateGadget(ActiveGadget,PanelWindow,NULL);
  325.  
  326.                             if(Class == IDCMP_RAWKEY)
  327.                             {
  328.                                 if(Code == IECODE_UP_PREFIX|103 && CommandWindow == PanelWindow)
  329.                                     ActivateGadget(CommandGadget,PanelWindow,NULL);
  330.                             }
  331.  
  332.                             if(Class == IDCMP_MENUPICK)
  333.                             {
  334.                                 struct MenuItem *MenuItem;
  335.  
  336.                                 while(Code != MENUNULL)
  337.                                 {
  338.                                     MenuItem = ItemAddress(PanelMenu,Code);
  339.  
  340.                                     switch((ULONG)MENU_USERDATA(MenuItem))
  341.                                     {
  342.                                         case MEN_QUITPANEL:    Class = IDCMP_CLOSEWINDOW;
  343.                                                     break;
  344.  
  345.                                         case MEN_BAUD:        if(Config -> BaudRate == Bauds[11])
  346.                                                         Value = 0;
  347.                                                     else
  348.                                                     {
  349.                                                         for(i = 0 ; i < 13 ; i++)
  350.                                                         {
  351.                                                             if(Config -> BaudRate == Bauds[i])
  352.                                                             {
  353.                                                                 Value = i + 1;
  354.                                                                 break;
  355.                                                             }
  356.                                                         }
  357.                                                     }
  358.  
  359.                                                     GT_SetGadgetAttrs(GadgetArray[GAD_BAUD],PanelWindow,NULL,
  360.                                                         GTSL_Level,Value,
  361.                                                     TAG_DONE);
  362.  
  363.                                                     Config -> BaudRate = Bauds[Value];
  364.  
  365.                                                     break;
  366.  
  367.                                         case MEN_DATABITS:    if(Config -> BitsPerChar == 8)
  368.                                                         Value = 0;
  369.                                                     else
  370.                                                         Value = 1;
  371.  
  372.                                                     GT_SetGadgetAttrs(GadgetArray[GAD_DATABITS],PanelWindow,NULL,
  373.                                                         GTCY_Active,Value,
  374.                                                     TAG_DONE);
  375.  
  376.                                                     Class = IDCMP_GADGETUP;
  377.                                                     Gadget = GadgetArray[GAD_DATABITS];
  378.                                                     Code = Value;
  379.  
  380.                                                     goto GadCheck;
  381.  
  382.                                         case MEN_PARITY:    if(Config -> Parity == PARITY_SPACE)
  383.                                                         Value = PARITY_NONE;
  384.                                                     else
  385.                                                         Value = Config -> Parity + 1;
  386.  
  387.                                                     GT_SetGadgetAttrs(GadgetArray[GAD_PARITY],PanelWindow,NULL,
  388.                                                         GTCY_Active,Value,
  389.                                                     TAG_DONE);
  390.  
  391.                                                     Class = IDCMP_GADGETUP;
  392.                                                     Gadget = GadgetArray[GAD_PARITY];
  393.                                                     Code = Value;
  394.  
  395.                                                     goto GadCheck;
  396.  
  397.                                         case MEN_STOPBITS:    if(Config -> StopBits == 2)
  398.                                                         Value = 0;
  399.                                                     else
  400.                                                         Value = 1;
  401.  
  402.                                                     GT_SetGadgetAttrs(GadgetArray[GAD_STOPBITS],PanelWindow,NULL,
  403.                                                         GTCY_Active,Value,
  404.                                                     TAG_DONE);
  405.  
  406.                                                     Class = IDCMP_GADGETUP;
  407.                                                     Gadget = GadgetArray[GAD_STOPBITS];
  408.                                                     Code = Value;
  409.  
  410.                                                     goto GadCheck;
  411.  
  412.                                         case MEN_HANDSHAKING:    if(Config -> Handshaking == HANDSHAKING_NONE)
  413.                                                             Value = HANDSHAKING_XONXOFF;
  414.                                                     else
  415.                                                         Value = Config -> Handshaking + 1;
  416.  
  417.                                                     GT_SetGadgetAttrs(GadgetArray[GAD_HANDSHAKING],PanelWindow,NULL,
  418.                                                         GTCY_Active,Value,
  419.                                                     TAG_DONE);
  420.  
  421.                                                     Class = IDCMP_GADGETUP;
  422.                                                     Gadget = GadgetArray[GAD_HANDSHAKING];
  423.                                                     Code = Value;
  424.  
  425.                                                     goto GadCheck;
  426.  
  427.                                         case MEN_DUPLEX:    if(Config -> Duplex == DUPLEX_FULL)
  428.                                                         Value = DUPLEX_HALF;
  429.                                                     else
  430.                                                         Value = DUPLEX_FULL;
  431.  
  432.                                                     GT_SetGadgetAttrs(GadgetArray[GAD_DUPLEX],PanelWindow,NULL,
  433.                                                         GTCY_Active,Value,
  434.                                                     TAG_DONE);
  435.  
  436.                                                     Class = IDCMP_GADGETUP;
  437.                                                     Gadget = GadgetArray[GAD_DUPLEX];
  438.                                                     Code = Value;
  439.  
  440.                                                     goto GadCheck;
  441.  
  442.                                         case MEN_HIGHSPEED:    GT_SetGadgetAttrs(GadgetArray[GAD_HIGHSPEED],PanelWindow,NULL,
  443.                                                         GTCB_Checked,GadgetArray[GAD_HIGHSPEED] -> Flags & GFLG_SELECTED ? FALSE : TRUE,
  444.                                                     TAG_DONE);
  445.  
  446.                                                     break;
  447.  
  448.                                         case MEN_USE:        Class = IDCMP_GADGETUP;
  449.                                                     Gadget = GadgetArray[GAD_USE];
  450.                                                     break;
  451.  
  452.                                         case MEN_CANCEL:    Class = IDCMP_GADGETUP;
  453.                                                     Gadget = GadgetArray[GAD_CANCEL];
  454.                                                     break;
  455.  
  456.                                         default:        break;
  457.                                     }
  458.  
  459.                                     Code = MenuItem -> NextSelect;
  460.                                 }
  461.  
  462.                                 if(ActiveGadget)
  463.                                     ActivateGadget(ActiveGadget,PanelWindow,NULL);
  464.                             }
  465.  
  466.                             if(Class == IDCMP_CLOSEWINDOW)
  467.                                 Terminated = TRUE;
  468.  
  469.                             if(Class == IDCMP_MOUSEMOVE)
  470.                             {
  471.                                 switch(Gadget -> GadgetID)
  472.                                 {
  473.                                     case GAD_BAUD:    Config -> BaudRate = Bauds[Code];
  474.                                             break;
  475.  
  476.                                     default:    break;
  477.                                 }
  478.                             }
  479.  
  480. GadCheck:                        if(Class == IDCMP_GADGETUP)
  481.                             {
  482.                                 switch(Gadget -> GadgetID)
  483.                                 {
  484.                                     case GAD_DUPLEX:    Config -> Duplex = Code;
  485.                                                 break;
  486.  
  487.                                     case GAD_HANDSHAKING:    Config -> Handshaking = Code;
  488.                                                 break;
  489.  
  490.                                     case GAD_STOPBITS:    Config -> StopBits = 1 + Code;
  491.                                                 break;
  492.  
  493.                                     case GAD_PARITY:    Config -> Parity = Code;
  494.                                                 break;
  495.  
  496.                                     case GAD_DATABITS:    Config -> BitsPerChar = 7 + Code;
  497.                                                 break;
  498.  
  499.                                     case GAD_USE:        Terminated = TRUE;
  500.  
  501.                                                 Config -> UnitNumber = ((struct StringInfo *)GadgetArray[GAD_UNIT] -> SpecialInfo) -> LongInt;
  502.  
  503.                                                 strcpy(Config -> SerialDevice,((struct StringInfo *)GadgetArray[GAD_DEVICE] -> SpecialInfo) -> Buffer);
  504.  
  505.                                                 Config -> BreakLength = ((struct StringInfo *)GadgetArray[GAD_BREAKLENGTH] -> SpecialInfo) -> LongInt;
  506.  
  507.                                                 Config -> HighSpeed = GadgetArray[GAD_HIGHSPEED] -> Flags & GFLG_SELECTED;
  508.  
  509.                                                 break;
  510.  
  511.                                     case GAD_CANCEL:    Terminated = TRUE;
  512.  
  513.                                                 CopyMem(&PrivateConfig,Config,sizeof(struct Configuration));
  514.  
  515.                                                 break;
  516.  
  517.                                     default:        break;
  518.                                 }
  519.                             }
  520.                         }
  521.                     }
  522.  
  523.                     PanelWindow -> Flags |= WFLG_RMBTRAP;
  524.  
  525.                     ClearMenuStrip(PanelWindow);
  526.  
  527.                     RemoveGList(PanelWindow,GadgetList,(UWORD)-1);
  528.  
  529.                     PopWindow();
  530.  
  531.                     CloseWindow(PanelWindow);
  532.                 }
  533.             }
  534.  
  535.             FreeMenus(PanelMenu);
  536.         }
  537.  
  538.         FreeGadgets(GadgetList);
  539.     }
  540.  
  541.     if(memcmp(&PrivateConfig,Config,sizeof(struct Configuration)))
  542.         return(TRUE);
  543.     else
  544.         return(FALSE);
  545. }
  546.